#include<iostream>
#include<cstring>
#include<queue>
#include<vector>
using namespace std;

const int N = 1e6 + 10, M = 2e6 + 10, MOD = 100003;

typedef pair<int, int>PII;

int n, m;

vector<int> edges[N];
//
int f[N];

int dist[N];
void bfs()
{
	memset(dist, 0x3f, sizeof dist);
	dist[1] = 0;
	f[1] = 1;
	queue<int> q;
	q.push(1);
	while (q.size())
	{
		int a = q.front(); q.pop();
		for (auto b : edges[a])
		{
			if (dist[a] = 0x3f3f3f3f) continue;
			if (dist[a] + 1 < dist[b])
			{
				dist[b] = dist[a] + 1;
				f[b] = f[a];
				q.push(b);
			}
			else if (dist[a] + 1 == dist[b])
			{
				f[b] += f[a];
			}
		}
	}

}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
	{
		int x, y; cin >> x >> y;
		edges[x].push_back(y);
		edges[y].push_back(x);
	}

	bfs();

	for (int i = 1; i <= n; i++) cout << f[i] << endl;

	return 0;
}





